%x=[-1.0,-0.5,0.0,0.5,1.0,1.5,2.0];
%y=[-4.447,-0.425,0.551,0.048,-0.447,0.549,4.552];
%x=-3:3;
%y=[4,2,3,0,-1,-2,-5];
x=[0.1,0.2,0.3,0.4,0.5];
y=[5.1234,5.3057,5.5687,5.9378,6.4370];
n=2;
m=length(x);
A=zeros(m,n+1);
for i=1:3
    A(:,i)=x.^(i-1)';
end
B=A'*A;
C=A'*y';
re=B\C;
y1=re(1)+re(2)*x+re(3)*x.*x;
plot(x,y,'r',x,y1,'g');